package com.dragon.english_practice_back.mapper;

import com.dragon.english_practice_back.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 伫倚
* @description 针对表【message(消息表)】的数据库操作Mapper
* @createDate 2025-03-09 20:14:01
* @Entity com.example.english_practice_back.entity.Message
*/
public interface MessageMapper extends BaseMapper<Message> {
    @Select("SELECT id,content,create_date,creator_id,type,session_id FROM message WHERE session_id = #{l} ORDER BY create_date DESC LIMIT #{lastN}")
    List<Message> getLastNMessages(int l, int lastN);

    List<Message> getLastAssistantMessage(int userId, Integer sessionId);
}




